#@adminLayout()

#define content()
#if(notice)
<script>
  alert("#(notice)");
</script>
#end
<div class="am-cf am-padding am-padding-bottom-0">
  <div class="am-fl am-cf">
    <strong class="am-text-primary am-text-lg">[#(tools.getAdminTypeStr(type))] 列表</strong>
  </div>
  <div style="float: right">
    <button class="am-btn am-btn-success am-btn-xs" onclick="window.location.href='/admin/administrator/add?type=#(type)'"><span class="am-icon-plus"></span>
      添加管理员
    </button>
  </div>
</div>
<hr>
<div class="am-g">
  <div class="am-u-sm-12">
    <table class="am-table am-table-striped am-table-hover table-main">
      <thead>
      <tr>
        <th class="table-id">ID</th>
        <th class="table-title">管理员名称</th>
        <th class="table-author">创建时间</th>
        <th class="table-set">操作</th>
      </tr>
      </thead>
      <tbody>
      #for(admin : adminList)
      <tr>
        <td>#(for.count)</td>
        <td>#(admin.name)</td>
        <td>#(tools.getDateStr(admin.createTime))</td>
        <td>
          <div class="am-btn-toolbar">
            <button type="button" class="am-btn am-btn-danger am-btn-xs" onclick="del('#(admin.id)', '#(type)');"><span
                class="am-icon-remove"></span>
              删除</button>
          </div>
        </td>
      </tr>
      #else
      <tr>
        <td colspan="4" style="text-align: center">暂无记录</td>
      </tr>
      #end
      </tbody>
    </table>
  </div>
</div>

<script type="text/javascript">
  function del(id, type) {
    if(confirm("确认执行删除操作?")) {
      var url = "/admin/administrator/delete?id=" + id + "&type=" + type;
      window.location.href=url;
    }
  }
</script>
#end